import React, { Component } from 'react';
import { BrowserRouter as Router, Link, Route } from 'react-router-dom';
import Home from './home';
import About from './about';
export default class Index extends Component {
  render() {
    return (
      <div>
        <Router>
          <h2>路由嵌套</h2>
          <nav>
            <Link to="/home">首页</Link>
            <Link to="/about">关于</Link>
          </nav>
          <main>
            <Route path="/" exact component={Home} />
            <Route path="/home" exact component={Home} />
            <Route path="/about" component={About} />
            <Route path={`/home/left`} component={() => <div>左侧</div>} />
            <Route path={`/home/right`} component={() => <div>右侧</div>} />
          </main>
        </Router>
      </div>
    );
  }
}
